package org.liuhy.line.rect
{
	import flash.display.Graphics;
	import flash.events.FocusEvent;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	
	import mx.collections.ArrayCollection;
	import mx.events.DragEvent;
	
	import org.liuhy.line.AbstractLine;
	import org.liuhy.line.Arrow;
	import org.liuhy.line.ArrowLineNode;
	import org.liuhy.line.CLine;
	import org.liuhy.line.MidLineNode;
	import org.liuhy.node.FlowNode;
	import org.liuhy.node.focus.BottomNode;
	import org.liuhy.node.focus.FocusNode;
	import org.liuhy.node.focus.LeftNode;
	import org.liuhy.node.focus.RightNode;
	import org.liuhy.node.focus.TopNode;
	import org.liuhy.utils.FlowNodeUtils;
	import org.liuhy.utils.LineUtils;
	//矩形折线;
	public class RectLine extends AbstractLine
	{
		private var _ADJUST_LEN:int = 10;
		public function RectLine(p_x1:int,p_y1:int,p_x2:int,p_y2:int,p_cLine:CLine)
		{
			super(p_x1,p_y1,p_x2,p_y2,p_cLine);
			this.midLineNode = new MidLineNode(p_x1 + (p_x2-p_x1)/2, p_y1+(p_y2-p_y1)/2);			
			this.addChild(midLineNode);
		}
		//失去焦点
		public function onFocusChange(event:FocusEvent):void{
//			this.setFocusVisible(false);
		}
		override public function setFocusVisible(p_bool:Boolean):void{
			var _arrayLine:ArrayCollection = LineUtils.getAllLine(this);
			for(var j:int=0;j<_arrayLine.length;j++){
				var _line:AbstractLine = _arrayLine.getItemAt(j) as AbstractLine;
				_line.fromLineNode.visible = p_bool;
				_line.midLineNode.visible  = p_bool;
				if(null!=_line.arrowLineNode){
					_line.arrowLineNode.visible = p_bool;
				}
			}			
		}
	
		public function onLineFocus(event:MouseEvent):void{
			this.stage.focus = this;
			this.setFocusVisible(true);
		}
		public function offLineFocus(event:MouseEvent):void{
			event.currentTarget.stopDrag();
		}
		override public function draw():void{	
			this.fromLineNode.x	=x1-3;
			this.fromLineNode.y	=y1-3;
			this.fromLineNode.setStyle("borderColor",this.lineNodeBorderColor);
			this.fromLineNode.setStyle("backgroundColor",this.lineNodeBackgroundColor);
//
			this.midLineNode.x  =Point.interpolate(new Point(this.x1,this.y1),new Point(this.x2,this.y2),1/2).x-3;
			this.midLineNode.y  =Point.interpolate(new Point(this.x1,this.y1),new Point(this.x2,this.y2),1/2).y-3;
			this.midLineNode.setStyle("borderColor",this.lineNodeBorderColor);
			this.midLineNode.setStyle("backgroundColor",this.lineNodeBackgroundColor);

			graphics.clear();			
			graphics.lineStyle(1, 0xffffff,0);
			graphics.beginFill(0xffffff,0);
			if(this.x1 == this.x2){
				//竖线
				if(y1<y2){
					graphics.drawRect(x1-5,y1+5,10,LineUtils.abs(y2-y1)-11);
				}else{
					graphics.drawRect(x1-5,y2+5,10,LineUtils.abs(y2-y1)-11);
				}
			}else{
				if(x1<x2){
					graphics.drawRect(x1+5,y1-5,LineUtils.abs(x2-x1)-11,10);
				}else{
					graphics.drawRect(x2+5,y1-5,LineUtils.abs(x2-x1)-11,10);
				}
			}
			graphics.lineStyle(1, this.lineColor);
			graphics.moveTo(x1,y1);
			graphics.lineTo(x2, y2);
			graphics.endFill();
//			var _visible:Boolean = false;
			//
			if(null!=this._arrow){
				try{
//					_visible = this.arrowLineNode.visible;
					this.removeChild(this._arrow);
					this.removeChild(this.arrowLineNode);
				}catch(e:Error){
					
				}
			}
			if(null==this.nextLine){
				//末端增加箭头
				_arrow 				= 	new Arrow();
				var toPoint:Point	=	new Point(this.x2,this.y2);
				var fromPoint:Point = 	new Point(this.x1,this.y1);
                _arrow.fromPoint	=	fromPoint;
                _arrow.toPoint		=	toPoint;
                _arrow.draw();
                this.addChild(_arrow);
                //末端增加调整方块
                arrowLineNode = new ArrowLineNode(this.x2,this.y2);
//                arrowLineNode.visible = _visible;
                this.arrowLineNode.setStyle("borderColor",this.lineNodeBorderColor);
				this.arrowLineNode.setStyle("backgroundColor",this.lineNodeBackgroundColor);
				this.addChild(arrowLineNode);
			}			
			this.setFocusVisible(this.cLine._selected);
		}
		private function drawDashed(graphics:Graphics,lineColor:uint, lineAlpha:Number, p1:Point, p2:Point,pointWidth:Number,pointLength:Number,twoPointDistance:Number):void{ 
			graphics.lineStyle(pointWidth, lineColor, lineAlpha); 
			var max:Number = Point.distance(p1, p2); 
			var dis:Number = 0;
			var p3:Point;              
			var p4:Point;              
			while(dis < max){                 
				p3 = Point.interpolate(p2, p1, dis / max);
				dis += pointLength;                 
				if(dis > max){                      
					dis = max;                  
				}                  
				p4 = Point.interpolate(p2, p1, dis / max);  
				graphics.moveTo(p3.x, p3.y); 
				graphics.lineTo(p4.x, p4.y);                 
				dis += twoPointDistance;             
			}            
		}  
		override public function virtualDraw():void{	
			this.setFocusVisible(false);
			graphics.clear();			
			graphics.beginFill(0xffffff,0);
			graphics.lineStyle(1, this.lineColor);
			this.drawDashed(this.graphics,this.lineColor,1,new Point(this.x1,this.y1),new Point(this.x2,this.y2),1,10,10);
			graphics.endFill();			
		}
		//改变箭头方向;
//		public function changeArrowDirect(event:ContextMenuEvent):void{
//			var _cmi:ContextMenuItem = event.currentTarget as ContextMenuItem;	
//			if(null==this.nextLine){	
//				if("up"==_cmi.caption){	
//					if(this.y1==this.y2){
//						//增加向上线段及箭头;
//						var _line:ULine = new ULine(this.x2,this.y2,this.x2,this.y2-40,this.cLine);
//						this.nextLine = _line;
//						_line.preLine = this;
//						this.draw();
//						_line.draw();
//					}else if(this.y2>this.y1){
//						this.y2 = this.y1 + (this.y1-this.y2);
//						this.draw();
//					}
//				}else if("down"==_cmi.caption){	
//					if(this.y1==this.y2){
//						//增加向上线段及箭头;
//						var _line:ULine = new ULine(this.x2,this.y2,this.x2,this.y2+40,this.cLine);
//						this.nextLine = _line;
//						_line.preLine = this;
//						this.draw();
//						_line.draw();
//					}else if(this.y2<this.y1){
//						this.y2 = this.y1 + (this.y1-this.y2);
//						this.draw();
//					}
//				}else if("left"==_cmi.caption){	
//					if(this.x1==this.x2){
//						//增加向上线段及箭头;
//						var _line:ULine = new ULine(this.x2,this.y2,this.x2-40,this.y2,this.cLine);
//						this.nextLine = _line;
//						_line.preLine = this;
//						this.draw();
//						_line.draw();
//					}else if(this.x2>this.x1){
//						this.x2 = this.x1 + (this.x1-this.x2);
//						this.draw();
//					}
//				}else if("right"==_cmi.caption){	
//					if(this.x1==this.x2){
//						//增加向上线段及箭头;
//						var _line:ULine = new ULine(this.x2,this.y2,this.x2+40,this.y2,this.cLine);
//						this.nextLine = _line;
//						_line.preLine = this;
//						this.draw();
//						_line.draw();
//					}else if(this.x2<this.x1){
//						this.x2 = this.x1 + (this.x1-this.x2);
//						this.draw();
//					}
//				}else if("toStraightLine"==_cmi.caption){	
//					var _c:CLine = this.parent as CLine;
//					_c.toStraightLine();
//				}
//			}
//		}
		//移动fromNode节点调整线;
		override public function fromNodeAdjustLine(p_event:DragEvent):void{		
			this.removeAllVirtualLine();	
			//拖动开始节点;
			var _uLine:AbstractLine = p_event.dragSource.dataForFormat("line") as AbstractLine;
			var _cLine:CLine = _uLine.parent as CLine;
			if(null!=_uLine.preLine) return;
			//删除与流程节点关联关系;
			FlowNodeUtils.disconnectFrom(_uLine);
			//竖线;
			if(_uLine.x1 == _uLine.x2){
				if(null==_uLine.nextLine){
					//一根直线
					var _y2:int = p_event.localY-_cLine.y + (_uLine.y2 - (p_event.localY-_cLine.y))/2;//
					var _line1:RectLine = new RectLine(p_event.localX-_cLine.x,p_event.localY-_cLine.y,p_event.localX-_cLine.x,_y2,_cLine);
					var _line2:RectLine = new RectLine(_line1.x2,_line1.y2,_uLine.x1,_y2,_cLine);
					var _line3:RectLine = new RectLine(_line2.x2,_line2.y2,_uLine.x2,_uLine.y2,_cLine);
					RectLineUtils.drawFromLine(null,_uLine,[_line1,_line2,_line3],[_uLine],null,null);
				}else{
					//多段线段;
					_uLine.nextLine.x1 = p_event.localX-_cLine.x;
					_uLine.nextLine.draw();
					_uLine.x1 = p_event.localX-_cLine.x;
					_uLine.y1 = p_event.localY-_cLine.y;
					_uLine.x2 = p_event.localX-_cLine.x;
					_uLine.y2 = _uLine.nextLine.y1;
					_uLine.draw();		
					RectLineUtils.toOneLine(_uLine);				
				}				
			}else{
				//横线;
				if(null==_uLine.nextLine){
					//一根直线
					var _x2:int = p_event.localX-_cLine.x+ (_uLine.x2 - (p_event.localX-_cLine.x))/2;//
					var _line1:RectLine = new RectLine(p_event.localX-_cLine.x,p_event.localY-_cLine.y,_x2,p_event.localY-_cLine.y,_cLine);
					var _line2:RectLine = new RectLine(_line1.x2,_line1.y2,_x2,_uLine.y1,_cLine);
					var _line3:RectLine = new RectLine(_line2.x2,_line2.y2,_uLine.x2,_uLine.y2,_cLine);
					RectLineUtils.drawFromLine(null,_uLine,[_line1,_line2,_line3],[_uLine],null,null);
				}else{
					//多段线段;
					_uLine.nextLine.y1 = p_event.localY-_cLine.y;
					_uLine.nextLine.draw();					
					_uLine.x1 = p_event.localX-_cLine.x;
					_uLine.y1 = p_event.localY-_cLine.y;
					_uLine.x2 = _uLine.nextLine.x1;
					_uLine.y2 = p_event.localY-_cLine.y;
					_uLine.draw();	
					RectLineUtils.toOneLine(_uLine);					
				}	
			}
			_cLine.adjustTitle(p_event);	
		}
		//移动开始结点虚线;
		override public function fromNodeAdjustVirtualLine(p_event:DragEvent):void{
			var _cLine:CLine = this.parent as CLine;
			var _x_:int = p_event.localX - _cLine.x;
			var _y_:int = p_event.localY - _cLine.y;
			this.removeAllVirtualLine();
//			//竖线;
			if(this.x1==this.x2){	
				if(null!=this.nextLine){
					//头
					var _rect1:RectLine =  new RectLine(_x_,_y_,_x_,this.y2,this.cLine);
					var _rect2:RectLine =  new RectLine(_rect1.x2,_rect1.y2,this.nextLine.x2,this.nextLine.y2,this.cLine);
					_rect1.nextLine 		= _rect2;
					_rect2.preLine 	= _rect1;
					_rect1.virtualDraw();
					_rect2.virtualDraw();					
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);
				}else{
					//一根竖线;
					var _y2:int = this.y1 + (this.y2 - this.y1)/2;//
					var _rect1:RectLine =  new RectLine(this.x1,_y2,this.x2,this.y2,this.cLine);
					var _rect2:RectLine =  new RectLine(_x_,_y2,_rect1.x1,_rect1.y1,this.cLine);
					var _rect3:RectLine =  new RectLine(_x_,_y_,_rect2.x1,_rect2.y1,this.cLine);					
					_rect3.nextLine = _rect2;
					_rect2.preLine 	= _rect3;
					_rect2.nextLine = _rect1;
					_rect1.preLine 	= _rect2;
					_rect1.virtualDraw();
					_rect2.virtualDraw();
					_rect3.virtualDraw();
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);					
					this.addVirtuaLine(_rect3);					
				}				
			}else if(this.y1==this.y2){
				if(null!=this.nextLine){
					//头
					var _rect1:RectLine =  new RectLine(_x_,_y_,this.x2,_y_,this.cLine);
					var _rect2:RectLine =  new RectLine(_rect1.x2,_rect1.y2,this.nextLine.x2,this.nextLine.y2,this.cLine);
					_rect1.nextLine 		= _rect2;
					_rect2.preLine 	= _rect1;
					_rect1.virtualDraw();
					_rect2.virtualDraw();					
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);
				}else{
					//一根横线;
					var _x2:int = this.x1 + (this.x2 - this.x1)/2;//
					var _rect1:RectLine =  new RectLine(_x2,this.y1,this.x2,this.y2,this.cLine);
					var _rect2:RectLine =  new RectLine(_x2,_y_,_rect1.x1,_rect1.y1,this.cLine);
					var _rect3:RectLine =  new RectLine(_x_,_y_,_rect2.x1,_rect2.y1,this.cLine);					
					_rect3.nextLine = _rect2;
					_rect2.preLine 	= _rect3;
					_rect2.nextLine = _rect1;
					_rect1.preLine 	= _rect2;
					_rect1.virtualDraw();
					_rect2.virtualDraw();
					_rect3.virtualDraw();
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);					
					this.addVirtuaLine(_rect3);					
				}	
			}
		}		
		//移动中间节点调整线;		
		override public function midNodeAdjustLine(p_event:DragEvent):void{
			this.removeAllVirtualLine();
			var _cLine:CLine = this.parent as CLine;
			var _x_:int = p_event.localX - _cLine.x;
			var _y_:int = p_event.localY - _cLine.y;
			//向左右移动
			if(this.x1==this.x2){				
				this.x1 		= _x_;
				this.x2 		= _x_;
				this.draw();
				//向左拉动
				if(null!=this.preLine){
					this.preLine.x2 =this.x1;
					this.preLine.draw();
				}
				if(null!=this.nextLine){
					this.nextLine.x1 = this.x2;						
					this.nextLine.draw();
				}
			}else if(this.y1==this.y2){
				this.y1 		= _y_;
				this.y2 		= _y_;
				this.draw();
				//向左拉动
				if(null!=this.preLine){
					this.preLine.y2 = this.y1;
					this.preLine.draw();
				}
				if(null!=this.nextLine){
					this.nextLine.y1 = this.y2;						
					this.nextLine.draw();
				}
			}
			//合并距离过近的线段;
			RectLineUtils.toOneLine(this);		
			_cLine.adjustTitle(null);
		}
		//虚线;
		override public function midNodeAdjustVirtualLine(p_event:DragEvent):void{
			var _cLine:CLine = this.parent as CLine;
			var _x_:int = p_event.localX - _cLine.x;
			var _y_:int = p_event.localY - _cLine.y;
			this.removeAllVirtualLine();
//			//竖线;
			if(this.x1==this.x2){				
				var _rect1:RectLine = null;
				//当前线;
				var _rect2:RectLine = new RectLine(_x_,this.y1,_x_,this.y2,this.cLine);
				var _rect3:RectLine = null;
				if(null!=this.preLine){
					_rect1 = new RectLine(this.preLine.x1,this.preLine.y1,_rect2.x1,_rect2.y1,this.cLine);
					_rect1.nextLine = _rect2;
					_rect2.preLine  = _rect1;
				}
				if(null!=this.nextLine){
					_rect3 = new RectLine(_rect2.x2,_rect2.y2,this.nextLine.x2,this.nextLine.y2,this.cLine);
					_rect2.nextLine = _rect3;
					_rect3.preLine  = _rect2;
				}
				if(null!=_rect1){
					 _rect1.virtualDraw();
					this.addVirtuaLine(_rect1);
				}
				_rect2.virtualDraw();
				this.addVirtuaLine(_rect2);
				if(null!=_rect3){
					_rect3.virtualDraw();
					this.addVirtuaLine(_rect3);
				} 
			}else if(this.y1==this.y2){
				//横线
				var _rect1:RectLine = null;
				//当前线;
				var _rect2:RectLine = new RectLine(this.x1,_y_,this.x2,_y_,this.cLine);
				var _rect3:RectLine = null;
				if(null!=this.preLine){
					_rect1 = new RectLine(this.preLine.x1,this.preLine.y1,_rect2.x1,_rect2.y1,this.cLine);
					_rect1.nextLine = _rect2;
					_rect2.preLine  = _rect1;
				}
				if(null!=this.nextLine){
					_rect3 = new RectLine(_rect2.x2,_rect2.y2,this.nextLine.x2,this.nextLine.y2,this.cLine);
					_rect2.nextLine = _rect3;
					_rect3.preLine  = _rect2;
				}
				if(null!=_rect1){
					 _rect1.virtualDraw();
					this.addVirtuaLine(_rect1);
				}
				_rect2.virtualDraw();
				this.addVirtuaLine(_rect2);
				if(null!=_rect3){
					_rect3.virtualDraw();
					this.addVirtuaLine(_rect3);
				} 
			}
		}
		//移动箭头节点调整线;
		override public function arrowNodeAdjustLine(p_event:DragEvent):void{
			this.removeAllVirtualLine();
			//删除线段与流程节点关联关系;
			var _uLine:AbstractLine = p_event.dragSource.dataForFormat("line") as AbstractLine;
			var _cLine:CLine = _uLine.parent as CLine;
			FlowNodeUtils.disconnectArrow(_uLine);
			//竖线;
			if(_uLine.x1 == _uLine.x2){
				if(null==_uLine.preLine){
					//一根直线
					var _y2:int = p_event.localY-_cLine.y + (_uLine.y1 - (p_event.localY-_cLine.y))/2;//
					var _line1:RectLine = new RectLine(_uLine.x1,_uLine.y1,_uLine.x1,_y2,_cLine);
					var _line2:RectLine = new RectLine(_line1.x2,_line1.y2,p_event.localX-_cLine.x,_y2,_cLine);
					var _line3:RectLine = new RectLine(_line2.x2,_line2.y2,p_event.localX-_cLine.x,p_event.localY-_cLine.y,_cLine);
					RectLineUtils.drawLine(null,_uLine,[_line1,_line2,_line3],[_uLine],null,null);
				}else{
					//多段线段;
					_uLine.preLine.x2 = p_event.localX-_cLine.x;
					_uLine.preLine.draw();
					_uLine.x1 = p_event.localX-_cLine.x;
					_uLine.y1 = _uLine.preLine.y2;
					_uLine.x2 = p_event.localX-_cLine.x;
					_uLine.y2 = p_event.localY-_cLine.y;
					_uLine.draw();	
					RectLineUtils.toOneLine(_uLine);				
				}				
			}else{
				//横线;
				if(null==_uLine.preLine){					
					////
					//一根直线
					var _x2:int = p_event.localX-_cLine.x + (_uLine.x1- (p_event.localX-_cLine.x))/2 ;//
					var _cLine:CLine = _uLine.parent as CLine;
					var _line1:RectLine = new RectLine(_uLine.x1,_uLine.y1,_x2,_uLine.y1,_cLine);
					var _line2:RectLine = new RectLine(_line1.x2,_line1.y2,_x2,p_event.localY-_cLine.y,_cLine);
					var _line3:RectLine = new RectLine(_line2.x2,_line2.y2,p_event.localX-_cLine.x,p_event.localY-_cLine.y,_cLine);
					RectLineUtils.drawLine(null,_uLine,[_line1,_line2,_line3],[_uLine],null,null);
				}else{
					//多段线段;
					_uLine.preLine.y2 = p_event.localY-_cLine.y;
					_uLine.preLine.draw();
					
					_uLine.x1 = _uLine.preLine.x2;
					_uLine.y1 = _uLine.preLine.y2;
					_uLine.x2 = p_event.localX-_cLine.x;
					_uLine.y2 = p_event.localY-_cLine.y;
					_uLine.draw();		
					RectLineUtils.toOneLine(_uLine);				
				}	
			}	
			_cLine.adjustTitle(p_event);	
		}
		//移动箭头结点虚线;
		override public function arrowNodeAdjustVirtualLine(p_event:DragEvent):void{
			var _cLine:CLine = this.parent as CLine;
			var _x_:int = p_event.localX - _cLine.x;
			var _y_:int = p_event.localY - _cLine.y;
			this.removeAllVirtualLine();
//			//竖线;
			if(this.x1==this.x2){	
				if(null!=this.preLine){
					//头
					var _rect1:RectLine =  new RectLine(_x_,this.y1,_x_,_y_,this.cLine);
					var _rect2:RectLine =  new RectLine(this.preLine.x1,this.preLine.y1,_rect1.x1,_rect1.y1,this.cLine);
					_rect1.preLine 		= _rect2;
					_rect2.nextLine 	= _rect1;
					_rect1.virtualDraw();
					_rect2.virtualDraw();					
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);
				}else{
					//一根竖线;
					var _y2:int = this.y1 + (this.y2 - this.y1)/2;//
					var _rect1:RectLine =  new RectLine(this.x1,this.y1,this.x1,_y2,this.cLine);
					var _rect2:RectLine =  new RectLine(_rect1.x2,_rect1.y2,_x_,_y2,this.cLine);
					var _rect3:RectLine =  new RectLine(_rect2.x2,_rect2.y2,_x_,_y_,this.cLine);					
					_rect1.nextLine	 = _rect2;
					_rect2.preLine	 = _rect1;
					_rect2.nextLine	 = _rect3;
					_rect3.preLine	 = _rect2;
					_rect1.virtualDraw();
					_rect2.virtualDraw();
					_rect3.virtualDraw();
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);					
					this.addVirtuaLine(_rect3);					
				}					
			}else if(this.y1==this.y2){
				if(null!=this.preLine){
					//头
					var _rect1:RectLine =  new RectLine(this.x1,_y_,_x_,_y_,this.cLine);
					var _rect2:RectLine =  new RectLine(this.preLine.x1,this.preLine.y1,_rect1.x1,_rect1.y1,this.cLine);
					_rect1.preLine 		= _rect2;
					_rect2.nextLine 	= _rect1;
					_rect1.virtualDraw();
					_rect2.virtualDraw();
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);
				}else{
					//一根竖线;
					var _x2:int = this.x1 + (this.x2 - this.x1)/2;//
					var _rect1:RectLine =  new RectLine(this.x1,this.y1,_x2,this.y1,this.cLine);
					var _rect2:RectLine =  new RectLine(_rect1.x2,_rect1.y2,_x2,_y_,this.cLine);
					var _rect3:RectLine =  new RectLine(_rect2.x2,_rect2.y2,_x_,_y_,this.cLine);					
					_rect1.nextLine	 = _rect2;
					_rect2.preLine	 = _rect1;
					_rect2.nextLine	 = _rect3;
					_rect3.preLine	 = _rect2;
					_rect1.virtualDraw();
					_rect2.virtualDraw();
					_rect3.virtualDraw();
					this.addVirtuaLine(_rect1);
					this.addVirtuaLine(_rect2);					
					this.addVirtuaLine(_rect3);					
				}	
			}
		}
		//移动箭头结点虚线(在flownode focus上);
		override public function arrowNodeFocusAdjustVirtualLine(p_focusNode:FocusNode):void{
			this.removeAllVirtualLine();
			var _cLine:CLine = this.parent as CLine;
			var _flowNode:FlowNode = p_focusNode.parent as FlowNode;
			FocusUtilsFactory.getFocusUtils(p_focusNode).arrowNodeFocusAdjustVirtualLine(p_focusNode,this,_flowNode);
		}
		//移动箭头结点虚线(在flownode focus上);
		override public function fromNodeFocusAdjustVirtualLine(p_focusNode:FocusNode):void{
			this.removeAllVirtualLine();
			var _cLine:CLine = this.parent as CLine;
			var _flowNode:FlowNode = p_focusNode.parent as FlowNode;
			FocusUtilsFactory.getFocusUtils(p_focusNode)..fromNodeFocusAdjustVirtualLine(p_focusNode,this,_flowNode);
		}
		override public function focusNodeDropArrowLine(p_focusNode:FocusNode):void{
			this.removeAllVirtualLine();
			var _flowNode:FlowNode = p_focusNode.parent as FlowNode;
			var _cLine:CLine = this.parent as CLine;
			//流程节点左侧焦点;
			FocusUtilsFactory.getFocusUtils(p_focusNode).focusNodeDropArrowLine(p_focusNode,this,_flowNode);
		}
		override public function focusNodeDropFromLine(p_focusNode:FocusNode):void{
			this.removeAllVirtualLine();
			var _flowNode:FlowNode = p_focusNode.parent as FlowNode;
			var _cLine:CLine = this.parent as CLine;
			FocusUtilsFactory.getFocusUtils(p_focusNode).focusNodeDropFromLine(p_focusNode,this,_flowNode);
		}
		//移动流程节点调整线；
		override public function focusNodeAdjustArrowLine(p_focusNode:FocusNode):void{
			var _flowNode:FlowNode = p_focusNode.parent as FlowNode;
			var _cLine:CLine = this.parent as CLine;
			FocusUtilsFactory.getFocusUtils(p_focusNode).focusNodeAdjustArrowLine(p_focusNode,this,_flowNode);
		}
		override public function focusNodeAdjustFromLine(p_focusNode:FocusNode):void{
			var _flowNode:FlowNode = p_focusNode.parent as FlowNode;
			var _cLine:CLine = this.parent as CLine;
			FocusUtilsFactory.getFocusUtils(p_focusNode).focusNodeAdjustFromLine(p_focusNode,this,_flowNode);
		}
		override public function set lineNodeBorderColor(p_color:uint):void{
			super.lineNodeBorderColor = p_color;
			this.fromLineNode.setStyle("borderColor",this.lineNodeBorderColor);
			this.midLineNode.setStyle("borderColor",this.lineNodeBorderColor);
			if(null==this.nextLine){				
                this.arrowLineNode.setStyle("borderColor",this.lineNodeBorderColor);
			}
		}
		override public function set lineNodeBackgroundColor(p_color:uint):void{
			super.lineNodeBackgroundColor = p_color;
			this.fromLineNode.setStyle("backgroundColor",this.lineNodeBackgroundColor);
			this.midLineNode.setStyle("backgroundColor",this.lineNodeBackgroundColor);
			if(null==this.nextLine){				
				this.arrowLineNode.setStyle("backgroundColor",this.lineNodeBackgroundColor);              
			}
		}
	}
}